<div class="row">
  <%= render 'menu' %>

  <div class="col-md-10">
    <div class="card card-lg">
      <div class="card-body">
        <div class="delete-account">
          <div class="heading">删除我的账号</div>

          <%= form_with(model: @user, url: setting_path, method: :delete) do |f| %>
            <%= render "shared/error_messages", :target => resource if params[:by] == "destroy" %>
            <input type="hidden" name="by" value="destroy" />
            <div class="form-group">
              <p>当然不想使用这个账号的时候，可以选择删除账号。</p>
              <p>删除以后数据将会保留，以匿名的方式存在，你的账号将无法再登录。</p>
            </div>
            <div class="form-group">
              <%= f.password_field :current_password, class: "form-control", style: "max-width: 400px", placeholder: t("users.confirm_delete_account") %>
            </div>
            <%= f.submit t("users.ensure_to_delete"), :class => "btn btn-danger", 'data-disable-with' => t("common.submitting") %>
          <% end %>
        </div>

        <% if !Setting.sso_enabled? && @user.authorizations.any? %>
          <div class="authorizations">
            <div class="heading">绑定其他账号用于登录</div>

            <ul class="list-group col-sm-6">
              <% @user.authorizations.each do |authorizaion| %>
                <li class="list-group-item">
                  <%= Homeland::Utils.omniauth_name(authorizaion.provider) %>
                  <%= link_to(raw('<i class="fas fa-minus-circle"></i>'), auth_unbind_setting_path(authorizaion.provider), rel: "twitsy", title: ("users.click_to_unbind"), method: 'delete' )%>
                </li>
              <% end %>
            </ul>
          </div>
        <% end %>
      </div>
    </div>
  </div>
</div>
